﻿using Efcore_Test.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Efcore_Test.Data.config
{
    public class StudentConfig : IEntityTypeConfiguration<Student>
    {
        public void Configure(EntityTypeBuilder<Student> builder)
        {
            builder.ToTable("T_Student");
            builder.HasMany<Teacher>(x => x.Teachers).WithMany(x => x.Students).UsingEntity(x => x.ToTable("T_Student_Teacher")); //多对多
        }
    }
}
